def send_email_file(email, filepath):

    import smtplib
    # 发送字符串的邮件
    from email.mime.text import MIMEText
    # 处理多种形态的邮件主体我们需要 MIMEMultipart 类
    from email.mime.multipart import MIMEMultipart


    # 设置服务器所需信息
    fromaddr = 'wxjczxwsy@163.com'  # 邮件发送方邮箱地址
    password = 'zhang990113'  # 密码(部分邮箱为授权码)
    toaddrs = email  # 邮件接受方邮箱地址，注意需要[]包裹，这意味着你可以写多个邮件地址群发

    # 设置email信息
    # ---------------------------发送字符串的邮件-----------------------------
    # 邮件内容设置
    message = MIMEMultipart()

    message['From'] = fromaddr
    # 接受方信息
    message['To'] = toaddrs
    message.attach(MIMEText("附件", "plain", "utf-8"))

    att = MIMEText(open(filepath, 'rb').read(), 'base64', 'utf-8')

    att['Content-Type'] = 'application/octet-stream'
    att['Content-Disposition'] = 'attachment;filename=' + filepath.split('/')[-1]

    message.attach(att)

    message['Subject'] = '小程序文件'
    # ---------------------------------------------------------------------
    # 登录并发送邮件
    try:
        server = smtplib.SMTP('smtp.163.com')  # 163邮箱服务器地址，端口默认为25

        server.login(fromaddr, password)
        server.sendmail(fromaddr, toaddrs, message.as_string())
        print('success')
        return True
        server.quit()

    except smtplib.SMTPException as e:
        print('error', e)  # 打印错误
        return False